package com.ruoyi.match.test.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.match.match.service.IMatchService;
import com.ruoyi.match.match.vo.MatchInfoVO;
import com.ruoyi.match.test.dto.JqCountDto;
import com.ruoyi.match.test.dto.JqCountListDto;
import com.ruoyi.match.test.service.TestService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author sjz
 * @Date 2023/11/20 17:27
 * @Desc
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/match/jq")
public class JqController {

    private final TestService testService;

    private final IMatchService iMatchService;

    @SaIgnore
    @GetMapping("/count")
    public R<JqCountListDto> getStatisticsByJqCount(@RequestParam(value = "matchFlag",required = false) String matchFlag){
        return R.ok(testService.getStatisticsByJqCount(matchFlag));
    }

    @SaIgnore
    @GetMapping("/countRealTime")
    public R<JqCountListDto> getStatisticsByJqCountRealTime(@RequestParam(value = "matchFlag",required = false) String matchFlag){
        return R.ok(testService.getStatisticsByJqCountRealTime(matchFlag));
    }


    @SaIgnore
    @GetMapping("/countRqRealTime")
    public R<List<JqCountDto>> getStatisticsByJqCountRqRealTime(@RequestParam(value = "matchFlag",required = false) String matchFlag){
        return R.ok(testService.getStatisticsByJqCountRqRealTime(matchFlag));
    }


    @SaIgnore
    @GetMapping("/ss")
    public R<MatchInfoVO> getHistoryInfo(@RequestParam(value = "id",required = false) Long id){
        return R.ok(iMatchService.getHistoryInfo(id));
    }

}
